<template>
  404
  <el-button @click="$router.push(goPath?.path || '/')">回到首页</el-button>
</template>

<script setup lang="ts">
import useUser from '@/stores/useUser'
import { menuRoutes } from '@/router'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'
const { userInfo } = storeToRefs(useUser())

const hasAuthRoute = menuRoutes.find((item) =>
  userInfo.value.authCodes.includes(item.meta.code as string)
)
let goPath = ref()
if (hasAuthRoute && hasAuthRoute.children) {
  goPath.value = hasAuthRoute.children?.find((item) =>
    userInfo.value.authCodes.includes(item.meta.code as string)
  )
} else {
  goPath.value = hasAuthRoute
}
// const goHome = () => {}
</script>

<style></style>
